package com.adnaan.backend.mapper;

import com.adnaan.backend.entity.SysPermission;
import com.adnaan.backend.entity.vo.RoleAuthority;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SysPermissionMapper extends BaseMapper<SysPermission> {

    @Select("SELECT permission_id FROM `sys_role_permission` WHERE role_id = #{roleId}")
    List<Long> getPermissionByRoleId(@Param("roleId") Long roleId);

    boolean assignPermission(RoleAuthority roleAuthority);

    boolean cancelPermission(RoleAuthority roleAuthority);
}